#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 2e5 + 10;
const int K = 18;

int n, m, tot, top;
int a[N], b[N], qup[N], st[2][K + 1][N], lg[N], pw[K + 10], stk[N];
ll ans[N], x[N];
vector < tuple < int, int, int > > pot[N];

int tmn(int x, int y) { return b[x] < b[y] ? x : y; }
int tmx(int x, int y) { return a[x] > a[y] ? x : y; }

int query0(int x, int y) { int k = lg[y - x + 1]; return tmx(st[0][k][x], st[0][k][y - pw[k] + 1]); }
int query1(int x, int y) { int k = lg[y - x + 1]; return tmn(st[1][k][x], st[1][k][y - pw[k] + 1]); }

int getpos(ll x) { return lower_bound(qup + 1, qup + tot + 1, x) - qup; }

namespace T {
	ll tr1[N], tr2[N];
	void add1(ll x, ll y) { x = getpos(x); for(; x <= tot; x += x & -x) tr1[x] += y; }
	void add2(ll x, ll y) { x = getpos(x); for(; x <= tot; x += x & -x) tr2[x] += y; }
	ll query1(ll x) { x = getpos(x); ll res = 0; for(; x; x -= x & -x) res += tr1[x]; return res; }
	ll query2(ll x) { x = getpos(x); ll res = 0; for(; x; x -= x & -x) res += tr2[x]; return res; }
	void add(ll x, ll y, ll w) { add1(x, w); add1(y, -w); add2(x, -w * (x - 1)); add2(y, w * y); }
	ll query(ll x) { return query1(x) * x + query2(x); }
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in; rep(i, 1, n) a[i] = in, x[i + 1] = x[i] + a[i];
	rep(i, 1, n) b[i] = in, st[0][0][i] = st[1][0][i] = i;
	pw[0] = 1; rep(i, 1, K) pw[i] = pw[i - 1] * 2; rep(i, 2, n) lg[i] = lg[i >> 1] + 1;
	rep(k, 1, K)
		rep(i, 1, n - pw[k] + 1)
		st[0][k][i] = tmx(st[0][k - 1][i], st[0][k - 1][i + pw[k - 1]]),
		st[1][k][i] = tmn(st[1][k - 1][i], st[1][k - 1][i + pw[k - 1]]);
	rep(i, 1, m) {
		int s = in, t = in, u = in; qup[++tot] = u;
		if(a[query0(s, t - 1)] > u) { ans[i] = -1; continue; }
		int trpos = query1(max(s, (int)(lower_bound(x + 1, x + n + 2, x[t] - u) - x)), t - 1);
		ans[i] = (x[t] - x[trpos]) * b[trpos];
		pot[s].eb(i, 1, u); pot[trpos].eb(i, -1, u);
	}
	sort(qup + 1, qup + tot + 1); tot = unique(qup + 1, qup + tot + 1) - qup - 1;
	stk[top = 1] = n + 1;
	per(i, n, 1) {
		while(top > 1 && b[i] < b[stk[top]]) T :: add(x[stk[top]] - x[i] + 1, x[stk[top - 1]] - x[i], -b[stk[top]]), top--;
		T :: add(1, x[stk[top]] - x[i], b[i]); stk[++top] = i;
		for(auto v : pot[i]) { int id, rt, pos; tie(id, rt, pos) = v; ans[id] += rt * T :: query(pos); }
	} rep(i, 1, m) printf("%lld\n", ans[i]);
	return 0;
}
